<include file="Common/header" />
<!-- 导航栏 -->
{$bread_crumb}
<!-- 导航栏 -->
<div class="page-container">
    <form action="{:U(CONTROLLER_NAME.'/add')}" method="post" class="form form-horizontal" onsubmit="return submit_before()">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">权限列表：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <foreach name="datas" item="item">
                    <dl class="permission-list">
                        <dt>
                            <label>{$item['title']}</label>
                        </dt>
                        <dd>
                            <dl class="cl permission-list2">
                                <dt>
                                    <label class="">
                                        <input type="checkbox" value="" name="user-Character-0-0" id="user-Character-0-0">
                                        {$item['title']}</label>
                                </dt>
                                <if condition="item.childs">
                                    <dd>
                                        <foreach name="item['childs']" item="it">
                                            <label class="">
                                            <input type="checkbox" value="" name="user-character-0-1-0" id="user-Character-0-1-0">
                                            {$it['title']}</label>
                                        </foreach>
                                    </dd>
                                </if>
                            </dl>
                        </dd>
                    </dl> 
                </foreach>
            </div>
        </form>
    </div>
</div>
<include file="Common/footer" />
<script type="text/javascript">
$(function(){
    $('.table-sort').dataTable();
});
/*用户-添加*/
function member_add(title,url,w,h){
    layer_show(title,url,w,h);
}
/*用户-查看*/
function member_show(title,url,id,w,h){
    layer_show(title,url,w,h);
}
/*用户-停用*/
function member_stop(obj,id){
    layer.confirm('确认要停用吗？',function(index){
        $.ajax({
            type: 'POST',
            url: '',
            dataType: 'json',
            success: function(data){
                $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>');
                $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
                $(obj).remove();
                layer.msg('已停用!',{icon: 5,time:1000});
            },
            error:function(data) {
                console.log(data.msg);
            },
        });     
    });
}

/*用户-启用*/
function member_start(obj,id){
    layer.confirm('确认要启用吗？',function(index){
        $.ajax({
            type: 'POST',
            url: '',
            dataType: 'json',
            success: function(data){
                $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>');
                $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
                $(obj).remove();
                layer.msg('已启用!',{icon: 6,time:1000});
            },
            error:function(data) {
                console.log(data.msg);
            },
        });
    });
}
/*用户-编辑*/
function member_edit(title,url,id,w,h){
    layer_show(title,url,w,h);
}
/*密码-修改*/
function change_password(title,url,id,w,h){
    layer_show(title,url,w,h);  
}
/*用户-删除*/
function member_del(obj,id){
    layer.confirm('确认要删除吗？',function(index){
        $.ajax({
            type: 'POST',
            url: '',
            dataType: 'json',
            success: function(data){
                $(obj).parents("tr").remove();
                layer.msg('已删除!',{icon:1,time:1000});
            },
            error:function(data) {
                console.log(data.msg);
            },
        });     
    });
}
</script> 